package com.dy.nygl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dy.nygl.mapper.DayYearMapper;
import com.dy.nygl.pojo.DayYear;
import com.dy.nygl.service.DayYearService;

@Service("dayyearService")
public class DayYearServiceImpl implements DayYearService {

	@Resource(name = "dayYearDao")
	private DayYearMapper dayYearDao;

	@Override
	public void insert(DayYear dayYear) {
		DayYear dayYear2 = new DayYear();

		dayYear2.setName(dayYear.getName());
		dayYear2.setElec(dayYear.getElec());
		dayYear2.setWater(dayYear.getWater());
		dayYear2.setNatur(dayYear.getNatur());
		dayYear2.setGasonline(dayYear.getGasonline());
		dayYear2.setDerv(dayYear.getDerv());
		dayYear2.setCoal(dayYear.getCoal());
		dayYear2.setDate(dayYear.getDate());
		dayYearDao.insertSelective(dayYear2);

	}

	@Override
	public void update(DayYear dayYear) {
		DayYear dayYear2 = new DayYear();
        dayYear2.setId(dayYear.getId());
		dayYear2.setName(dayYear.getName());
		dayYear2.setElec(dayYear.getElec());
		dayYear2.setWater(dayYear.getWater());
		dayYear2.setNatur(dayYear.getNatur());
		dayYear2.setGasonline(dayYear.getGasonline());
		dayYear2.setDerv(dayYear.getDerv());
		dayYear2.setCoal(dayYear.getCoal());
		dayYear2.setDate(dayYear.getDate());
		dayYearDao.updateByPrimaryKeySelective(dayYear2);

	}

	@Override
	public List<DayYear> selectAll() {
		List<DayYear> list=dayYearDao.selectAll();
		return list;
	}

	@Override
	public List<DayYear> selectLike(String date) {
		List<DayYear> list=dayYearDao.selectLike(date);
		return list;
	}

	@Override
	public DayYear selectByDate(String date) {
		DayYear dayYear=dayYearDao.selectByDate(date);
		return dayYear;
	}

	@Override
	public List<DayYear> selectPeriods(Integer beginId, Integer endId) {
		List<DayYear> list=dayYearDao.selectPeriods(beginId, endId);
		return list;
	}

}
